//
//  ProductInfocell.swift
//  Wmsmobile
//
//  Created by Nick xu on 16/8/5.
//  Copyright © 2016年 hddden. All rights reserved.
//

import UIKit

class HDProductInfocell: HDFounctionBaseCell , HDgetAndSetProtocol {
    //MARK: - property
    override var info: [String : String]?{
        didSet{
            self.textField.text = info!["text"]
        }
    }
    lazy var textField: UILabel = {
        let label = UILabel()
        label.textColor = UIColor.hexStringToUIColor("#666666")
        label.font = UIFont.systemFont(ofSize: self.getFont())
        label.numberOfLines = 0
//        label.backgroundColor = UIColor.redColor()
        return label
    }()
    
    //MARK: - life cycle
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: UITableViewCellStyle.default, reuseIdentifier: "ProductInfocell")
        self.setUpUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.setUpUI()
    }
    
    required init() {
        super.init(style: UITableViewCellStyle.default, reuseIdentifier: "ProductInfocell")
        self.setUpUI()
    }
    //MARK: - public
    override func clearContent() {
        self.textField.text = ""
    }
    //MARK: - private
    func setUpUI(){
//        self.textLabel?.adjustsFontSizeToFitWidth = true
        self.addSubview(self.textField)
        textField.snp.makeConstraints { (make) in
            make.leading.equalTo(self).offset(inputViewToCellSpace-10)
            make.top.equalTo(self)
            make.bottom.equalTo(self)
            make.trailing.equalTo(self).offset(-FTCellHorizontalSpace)
        }
    }
    //MARK: - delegate
    func getText() -> (String?) {
        return self.textField.text
    }
    func SetText(_ text: String?) {
        self.textField.text = text
    }
}
